﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using bdxyit.com.RecruitmentAppSys.ViewModels;
using System.Diagnostics;

namespace bdxyit.com.RecruitmentAppSys.Controllers
{
    public class WorkHistoryController : Controller
    {
        // GET: /WorkHistory/
        public ActionResult Index(string id)
        {
            return View();
        }

        //
        // GET: /WorkHistory/Details/5

        public ActionResult Details(string id)
        {
            var workHistory = new WorkHistoryViewModels();
            //workHistory.ProfessionalTechnicalInfo1 = new ProfessionalTechnicalInfo();
            //workHistory.ProfessionalTechnicalInfo2 = new ProfessionalTechnicalInfo();
            //workHistory.ProfessionalTechnicalInfo3 = new ProfessionalTechnicalInfo();
            //workHistory.ProfessionalTechnicalInfo4 = new ProfessionalTechnicalInfo();
            //workHistory.ProfessionalTechnicalInfo5 = new ProfessionalTechnicalInfo();

            //workHistory.SkillLevelIdentificationInfo1 = new SkillLevelIdentificationInfo();
            //workHistory.SkillLevelIdentificationInfo2 = new SkillLevelIdentificationInfo();
            //workHistory.SkillLevelIdentificationInfo3 = new SkillLevelIdentificationInfo();
            //workHistory.SkillLevelIdentificationInfo4 = new SkillLevelIdentificationInfo();
            //workHistory.SkillLevelIdentificationInfo5 = new SkillLevelIdentificationInfo();

            //workHistory.OccupationalQualificationInfo1 = new OccupationalQualificationInfo();
            //workHistory.OccupationalQualificationInfo2 = new OccupationalQualificationInfo();
            //workHistory.OccupationalQualificationInfo3 = new OccupationalQualificationInfo();
            //workHistory.OccupationalQualificationInfo4 = new OccupationalQualificationInfo();
            //workHistory.OccupationalQualificationInfo5 = new OccupationalQualificationInfo();

            //workHistory.OtherEligibilityInfo1 = new OtherEligibilityInfo();
            //workHistory.OtherEligibilityInfo2 = new OtherEligibilityInfo();
            //workHistory.OtherEligibilityInfo3 = new OtherEligibilityInfo();
            //workHistory.OtherEligibilityInfo4 = new OtherEligibilityInfo();
            //workHistory.OtherEligibilityInfo5 = new OtherEligibilityInfo();
            ////workHistory.WorkListInfo = rdb.WorkListInfos.Where(a => a.UserID == id).ToList();
            //workHistory.ProfessionalTechnicalInfo1 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //workHistory.SkillLevelIdentificationInfo1 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //workHistory.OccupationalQualificationInfo1 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //workHistory.OtherEligibilityInfo1 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);

            //workHistory.ProfessionalTechnicalInfo2 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //workHistory.SkillLevelIdentificationInfo2 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //workHistory.OccupationalQualificationInfo2 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 21);
            //workHistory.OtherEligibilityInfo2 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);

            //workHistory.ProfessionalTechnicalInfo3 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //workHistory.SkillLevelIdentificationInfo3 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //workHistory.OccupationalQualificationInfo3 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //workHistory.OtherEligibilityInfo3 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);

            //workHistory.ProfessionalTechnicalInfo4 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //workHistory.SkillLevelIdentificationInfo4 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //workHistory.OccupationalQualificationInfo4 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 41);
            //workHistory.OtherEligibilityInfo4 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);

            //workHistory.ProfessionalTechnicalInfo5 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //workHistory.SkillLevelIdentificationInfo5 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //workHistory.OccupationalQualificationInfo5 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //workHistory.OtherEligibilityInfo5 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);

            //workHistory.UserInfo = rdb.UserInfos.SingleOrDefault(a => a.UserID == id);
            //workHistory.SystemInfoProType = rdb.SystemInfos.Where(a => a.Type == "ProAndTechSeries").ToList();
            //workHistory.SkillList = rdb.SkillLists.ToList();
            //workHistory.SystemInfoProlevel = rdb.SystemInfos.Where(a => a.Type == "ProAndTechLevel").ToList();
            //workHistory.TitlesList = rdb.TitlesLists.ToList();
            //workHistory.SystemInfoLevel = rdb.SystemInfos.Where(a => a.Type == "IdentificationLevel").ToList();
            //workHistory.SystemInfoOccType = rdb.SystemInfos.Where(a => a.Type == "VocationalType").ToList();
            //workHistory.SystemInfoOther = rdb.SystemInfos.Where(a => a.Type == "OtherType").ToList();
            return View(workHistory);
        }

        //
        // GET: /WorkHistory/Create

        public ActionResult Create(string id)
        {
            //var workHistory = new WorkHistoryViewModels();
            //workHistory.ProfessionalTechnicalInfo1 = new ProfessionalTechnicalInfo();
            //workHistory.UserInfo = new UserInfo();

            //workHistory.UserInfo = rdb.UserInfos.SingleOrDefault(a => a.UserID == id);
            //workHistory.SystemInfoProType = rdb.SystemInfos.Where(a => a.Type == "ProAndTechSeries").ToList();
            //workHistory.SkillList = rdb.SkillLists.ToList();
            //workHistory.SystemInfoProlevel = rdb.SystemInfos.Where(a => a.Type == "ProAndTechLevel").ToList();
            //workHistory.TitlesList = rdb.TitlesLists.ToList();
            //workHistory.SystemInfoLevel = rdb.SystemInfos.Where(a => a.Type == "IdentificationLevel").ToList();
            //workHistory.SystemInfoOccType = rdb.SystemInfos.Where(a => a.Type == "VocationalType").ToList();
            //workHistory.SystemInfoOther = rdb.SystemInfos.Where(a => a.Type == "OtherType").ToList();
            //workHistory.ProfessionalTechnicalInfo1.UserID = id;
            //workHistory.UserInfo.Training = "";
            //workHistory.UserInfo.Performance = "";
            //try
            //{
                //var pro = rdb.ProfessionalTechnicalInfos.Where(a => a.UserID == id);
                //if (pro != null)
                //{
                //    foreach (var p in pro)
                //    {
                //        rdb.ProfessionalTechnicalInfos.Remove(p);
                //    }
                //}

                //var skl = rdb.SkillLevelIdentificationInfos.Where(a => a.UserID == id);
                //if (skl != null)
                //{
                //    foreach (var s in skl)
                //    {
                //        rdb.SkillLevelIdentificationInfos.Remove(s);
                //    }
                //}

                //var occ = rdb.OccupationalQualificationInfos.Where(a => a.UserID == id);
                //{
                //    foreach (var o in occ)
                //    {
                //        rdb.OccupationalQualificationInfos.Remove(o);
                //    }
                //}

                //var oth = rdb.OtherEligibilityInfos.Where(a => a.UserID == id);
                //{
                //    foreach (var o in oth)
                //    {
                //        rdb.OtherEligibilityInfos.Remove(o);
                //    }
                //}
                //rdb.SaveChanges();
            //}
            //catch 
            //{
            //    return RedirectToAction("Index");
            //}
           return RedirectToAction("Index");

        }

        //
        // POST: /WorkHistory/Create

        [HttpPost]
        public ActionResult Create(WorkHistoryViewModels workHistory, FormCollection form)
        {
            //string id = form["ProfessionalTechnicalInfo1.UserID"].ToString();
            //string[] sys = form["SysID"].Split(new char[]{','});
            //string[] skill = form["SkillID"].Split(new char[]{','});
            //string[] title = form["TitlesID"].Split(new char[]{','});
            //workHistory.ProfessionalTechnicalInfo1.Flag = 1;
            //workHistory.ProfessionalTechnicalInfo1.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo1.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo1.ProTecID = sys[0].ToString();
            //workHistory.ProfessionalTechnicalInfo1.ProTecLevelID = sys[1].ToString();
            //workHistory.ProfessionalTechnicalInfo1.ProTecNameID = skill[0].ToString();
         
            //workHistory.ProfessionalTechnicalInfo2.Flag = 2;
            //workHistory.ProfessionalTechnicalInfo2.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo2.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo2.ProTecID = sys[2].ToString();
            //workHistory.ProfessionalTechnicalInfo2.ProTecLevelID = sys[3].ToString();
            //workHistory.ProfessionalTechnicalInfo2.ProTecNameID = skill[1].ToString();

            //workHistory.ProfessionalTechnicalInfo3.Flag = 3;
            //workHistory.ProfessionalTechnicalInfo3.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo3.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo3.ProTecID = sys[4].ToString();
            //workHistory.ProfessionalTechnicalInfo3.ProTecLevelID = sys[5].ToString();
            //workHistory.ProfessionalTechnicalInfo3.ProTecNameID = skill[2].ToString();

            //workHistory.ProfessionalTechnicalInfo4.Flag = 4;
            //workHistory.ProfessionalTechnicalInfo4.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo4.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo4.ProTecID = sys[6].ToString();
            //workHistory.ProfessionalTechnicalInfo4.ProTecLevelID = sys[7].ToString();
            //workHistory.ProfessionalTechnicalInfo4.ProTecNameID = skill[3].ToString();

            //workHistory.ProfessionalTechnicalInfo5.Flag = 5;
            //workHistory.ProfessionalTechnicalInfo5.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo5.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo5.ProTecID = sys[8].ToString();
            //workHistory.ProfessionalTechnicalInfo5.ProTecLevelID = sys[9].ToString();
            //workHistory.ProfessionalTechnicalInfo5.ProTecNameID = skill[4].ToString();


            //workHistory.SkillLevelIdentificationInfo1.Flag = 1;
            //workHistory.SkillLevelIdentificationInfo1.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo1.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo1.SKillLevelID = sys[10].ToString();
            //workHistory.SkillLevelIdentificationInfo1.SkillTypeID = title[0].ToString();

            //workHistory.SkillLevelIdentificationInfo2.Flag = 2;
            //workHistory.SkillLevelIdentificationInfo2.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo2.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo2.SKillLevelID = sys[11].ToString();
            //workHistory.SkillLevelIdentificationInfo2.SkillTypeID = title[1].ToString();

            //workHistory.SkillLevelIdentificationInfo3.Flag = 3;
            //workHistory.SkillLevelIdentificationInfo3.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo3.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo3.SKillLevelID = sys[12].ToString();
            //workHistory.SkillLevelIdentificationInfo3.SkillTypeID = title[2].ToString();

            //workHistory.SkillLevelIdentificationInfo4.Flag = 4;
            //workHistory.SkillLevelIdentificationInfo4.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo4.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo4.SKillLevelID = sys[13].ToString();
            //workHistory.SkillLevelIdentificationInfo4.SkillTypeID = title[3].ToString();

            //workHistory.SkillLevelIdentificationInfo5.Flag = 5;
            //workHistory.SkillLevelIdentificationInfo5.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo5.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo5.SKillLevelID = sys[14].ToString();
            //workHistory.SkillLevelIdentificationInfo5.SkillTypeID = title[4].ToString();

            //workHistory.OccupationalQualificationInfo1.Flag = 1;
            //workHistory.OccupationalQualificationInfo1.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo1.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo1.OccQuaID = sys[15].ToString();
            //workHistory.OccupationalQualificationInfo1.OccQuaLevelID = sys[16].ToString();

            //workHistory.OccupationalQualificationInfo2.Flag = 2;
            //workHistory.OccupationalQualificationInfo2.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo2.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo2.OccQuaID = sys[17].ToString();
            //workHistory.OccupationalQualificationInfo2.OccQuaLevelID = sys[18].ToString();

            //workHistory.OccupationalQualificationInfo3.Flag = 3;
            //workHistory.OccupationalQualificationInfo3.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo3.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo3.OccQuaID = sys[19].ToString();
            //workHistory.OccupationalQualificationInfo3.OccQuaLevelID = sys[20].ToString();

            //workHistory.OccupationalQualificationInfo4.Flag = 4;
            //workHistory.OccupationalQualificationInfo4.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo4.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo4.OccQuaID = sys[21].ToString();
            //workHistory.OccupationalQualificationInfo4.OccQuaLevelID = sys[22].ToString();

            //workHistory.OccupationalQualificationInfo5.Flag = 5;
            //workHistory.OccupationalQualificationInfo5.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo5.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo5.OccQuaID = sys[23].ToString();
            //workHistory.OccupationalQualificationInfo5.OccQuaLevelID = sys[24].ToString();

            //workHistory.OtherEligibilityInfo1.Flag = 1;
            //workHistory.OtherEligibilityInfo1.UserID = id;
            //workHistory.OtherEligibilityInfo1.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo1.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo1.OtherID = sys[23].ToString();

            //workHistory.OtherEligibilityInfo2.Flag = 2;
            //workHistory.OtherEligibilityInfo2.UserID = id;
            //workHistory.OtherEligibilityInfo2.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo2.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo2.OtherID = sys[24].ToString();

            //workHistory.OtherEligibilityInfo3.Flag = 3;
            //workHistory.OtherEligibilityInfo3.UserID = id;
            //workHistory.OtherEligibilityInfo3.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo3.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo3.OtherID = sys[25].ToString();

            //workHistory.OtherEligibilityInfo4.Flag = 4;
            //workHistory.OtherEligibilityInfo4.UserID = id;
            //workHistory.OtherEligibilityInfo4.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo4.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo4.OtherID = sys[26].ToString();

            //workHistory.OtherEligibilityInfo5.Flag = 5;
            //workHistory.OtherEligibilityInfo5.UserID = id;
            //workHistory.OtherEligibilityInfo5.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo5.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo5.OtherID = sys[27].ToString();

            //workHistory.ProfessionalTechnicalInfo1.UserID = id;
            //workHistory.ProfessionalTechnicalInfo1.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo1.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo2.UserID = id;
            //workHistory.ProfessionalTechnicalInfo2.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo2.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo3.UserID = id;
            //workHistory.ProfessionalTechnicalInfo3.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo3.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo4.UserID = id;
            //workHistory.ProfessionalTechnicalInfo4.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo4.EndTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo5.UserID = id;
            //workHistory.ProfessionalTechnicalInfo5.StartTime = DateTime.Now;
            //workHistory.ProfessionalTechnicalInfo5.EndTime = DateTime.Now;

            //workHistory.SkillLevelIdentificationInfo1.UserID = id;
            //workHistory.SkillLevelIdentificationInfo1.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo1.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo2.UserID = id;
            //workHistory.SkillLevelIdentificationInfo2.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo2.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo3.UserID = id;
            //workHistory.SkillLevelIdentificationInfo3.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo3.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo4.UserID = id;
            //workHistory.SkillLevelIdentificationInfo4.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo4.EndTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo5.UserID = id;
            //workHistory.SkillLevelIdentificationInfo5.StartTime = DateTime.Now;
            //workHistory.SkillLevelIdentificationInfo5.EndTime = DateTime.Now;

            //workHistory.OccupationalQualificationInfo1.UserID = id;
            //workHistory.OccupationalQualificationInfo1.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo1.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo2.UserID = id;
            //workHistory.OccupationalQualificationInfo2.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo2.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo3.UserID = id;
            //workHistory.OccupationalQualificationInfo3.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo3.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo4.UserID = id;
            //workHistory.OccupationalQualificationInfo4.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo4.EndTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo5.UserID = id;
            //workHistory.OccupationalQualificationInfo5.StartTime = DateTime.Now;
            //workHistory.OccupationalQualificationInfo5.EndTime = DateTime.Now;

            //workHistory.OtherEligibilityInfo1.UserID = id;
            //workHistory.OtherEligibilityInfo1.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo1.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo2.UserID = id;
            //workHistory.OtherEligibilityInfo2.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo2.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo3.UserID = id;
            //workHistory.OtherEligibilityInfo3.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo3.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo4.UserID = id;
            //workHistory.OtherEligibilityInfo4.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo4.EndTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo5.UserID = id;
            //workHistory.OtherEligibilityInfo5.StartTime = DateTime.Now;
            //workHistory.OtherEligibilityInfo5.StartTime = DateTime.Now;
            //try
            //{
            //    rdb.ProfessionalTechnicalInfos.Add(workHistory.ProfessionalTechnicalInfo1);
            //    rdb.ProfessionalTechnicalInfos.Add(workHistory.ProfessionalTechnicalInfo2);
            //    rdb.ProfessionalTechnicalInfos.Add(workHistory.ProfessionalTechnicalInfo3);
            //    rdb.ProfessionalTechnicalInfos.Add(workHistory.ProfessionalTechnicalInfo4);
            //    rdb.ProfessionalTechnicalInfos.Add(workHistory.ProfessionalTechnicalInfo5);

            //    rdb.SkillLevelIdentificationInfos.Add(workHistory.SkillLevelIdentificationInfo1);
            //    rdb.SkillLevelIdentificationInfos.Add(workHistory.SkillLevelIdentificationInfo2);
            //    rdb.SkillLevelIdentificationInfos.Add(workHistory.SkillLevelIdentificationInfo3);
            //    rdb.SkillLevelIdentificationInfos.Add(workHistory.SkillLevelIdentificationInfo4);
            //    rdb.SkillLevelIdentificationInfos.Add(workHistory.SkillLevelIdentificationInfo5);

            //    rdb.OccupationalQualificationInfos.Add(workHistory.OccupationalQualificationInfo1);
            //    rdb.OccupationalQualificationInfos.Add(workHistory.OccupationalQualificationInfo2);
            //    rdb.OccupationalQualificationInfos.Add(workHistory.OccupationalQualificationInfo3);
            //    rdb.OccupationalQualificationInfos.Add(workHistory.OccupationalQualificationInfo4);
            //    rdb.OccupationalQualificationInfos.Add(workHistory.OccupationalQualificationInfo5);

            //    rdb.OtherEligibilityInfos.Add(workHistory.OtherEligibilityInfo1);
            //    rdb.OtherEligibilityInfos.Add(workHistory.OtherEligibilityInfo2);
            //    rdb.OtherEligibilityInfos.Add(workHistory.OtherEligibilityInfo3);
            //    rdb.OtherEligibilityInfos.Add(workHistory.OtherEligibilityInfo4);
            //    rdb.OtherEligibilityInfos.Add(workHistory.OtherEligibilityInfo5);

            //    var usInfo = rdb.UserInfos.Find(id);
            //    if (usInfo != null) 
            //    {
            //        usInfo.Training = workHistory.UserInfo.Training;
            //        usInfo.Performance = workHistory.UserInfo.Performance;
            //        TryUpdateModel(usInfo);
            //    }

            //    rdb.SaveChanges();
            //    return RedirectToAction("Create", "WorkListInfo", new
            //    {
            //        id = workHistory.ProfessionalTechnicalInfo1.UserID+",1"
            //    });
            //}
            //catch
            //{
            //    return RedirectToAction("Index");
            //}
            return RedirectToAction("Index");
        }

        //
        // GET: /WorkHistory/Edit/5

        public ActionResult Edit(string id)
        {
            ////id = "12312312";
            //var workHistory = new WorkHistoryViewModels();
            //workHistory.ProfessionalTechnicalInfo1 = new ProfessionalTechnicalInfo();
            //workHistory.ProfessionalTechnicalInfo1.UserID = id;
            ////workHistory.WorkListInfo = rdb.WorkListInfos.Where(a => a.UserID == id).ToList();
            //workHistory.ProfessionalTechnicalInfo1 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //workHistory.SkillLevelIdentificationInfo1 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //workHistory.OccupationalQualificationInfo1 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //workHistory.OtherEligibilityInfo1 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);

            //workHistory.ProfessionalTechnicalInfo2 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //workHistory.SkillLevelIdentificationInfo2 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //workHistory.OccupationalQualificationInfo2 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //workHistory.OtherEligibilityInfo2 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);

            //workHistory.ProfessionalTechnicalInfo3 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //workHistory.SkillLevelIdentificationInfo3 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //workHistory.OccupationalQualificationInfo3 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //workHistory.OtherEligibilityInfo3 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);

            //workHistory.ProfessionalTechnicalInfo4 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //workHistory.SkillLevelIdentificationInfo4 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //workHistory.OccupationalQualificationInfo4 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //workHistory.OtherEligibilityInfo4 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);

            //workHistory.ProfessionalTechnicalInfo5 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //workHistory.SkillLevelIdentificationInfo5 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //workHistory.OccupationalQualificationInfo5 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //workHistory.OtherEligibilityInfo5 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);

            //workHistory.UserInfo = rdb.UserInfos.SingleOrDefault(a => a.UserID == id);
            //workHistory.SystemInfoProType = rdb.SystemInfos.Where(a => a.Type == "ProAndTechSeries").ToList();
            //workHistory.SkillList = rdb.SkillLists.ToList();
            //workHistory.SystemInfoProlevel = rdb.SystemInfos.Where(a => a.Type == "ProAndTechLevel").ToList();
            //workHistory.TitlesList = rdb.TitlesLists.ToList();
            //workHistory.SystemInfoLevel = rdb.SystemInfos.Where(a => a.Type == "IdentificationLevel").ToList();
            //workHistory.SystemInfoOccType = rdb.SystemInfos.Where(a => a.Type == "VocationalType").ToList();
            //workHistory.SystemInfoOther = rdb.SystemInfos.Where(a => a.Type == "OtherType").ToList();
            return View();
        }

        //
        // POST: /WorkHistory/Edit/5

        [HttpPost]
        public ActionResult Edit(WorkHistoryViewModels WorkHistory, FormCollection form)
        {
            //string id = form["ProfessionalTechnicalInfo1.UserID"].ToString();
            //string[] sys = form["SysID"].Split(new char[] { ',' });
            //string[] skill = form["SkillID"].Split(new char[] { ',' });
            //string[] title = form["TitlesID"].Split(new char[] { ',' });
            //try
            //{
            //    var por1 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a=> a.UserID==id && a.Flag==1);
            //    if (por1!=null)
            //    {
            //        rdb.ProfessionalTechnicalInfos.Remove(por1);
            //        WorkHistory.ProfessionalTechnicalInfo1.StartTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo1.EndTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo1.ProTecID = sys[0].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo1.ProTecNameID = skill[0].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo1.ProTecLevelID = sys[1].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo1.UserID = id;
            //        WorkHistory.ProfessionalTechnicalInfo1.Flag = 1;
            //        rdb.ProfessionalTechnicalInfos.Add(WorkHistory.ProfessionalTechnicalInfo1);
            //    }
            //    var por2 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //    if (por2 != null)
            //    {
            //        rdb.ProfessionalTechnicalInfos.Remove(por2);
            //        WorkHistory.ProfessionalTechnicalInfo2.StartTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo2.EndTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo2.ProTecID = sys[2].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo2.ProTecNameID = skill[1].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo2.ProTecLevelID = sys[3].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo2.UserID = id;
            //        WorkHistory.ProfessionalTechnicalInfo2.Flag = 2;
            //        rdb.ProfessionalTechnicalInfos.Add(WorkHistory.ProfessionalTechnicalInfo2);
            //    }
            //    var por3 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //    if (por3 != null)
            //    {
            //        rdb.ProfessionalTechnicalInfos.Remove(por3);
            //        WorkHistory.ProfessionalTechnicalInfo3.StartTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo3.EndTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo3.ProTecID = sys[4].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo3.ProTecNameID = skill[2].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo3.ProTecLevelID = sys[5].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo3.UserID = id;
            //        WorkHistory.ProfessionalTechnicalInfo3.Flag = 3;
            //        rdb.ProfessionalTechnicalInfos.Add(WorkHistory.ProfessionalTechnicalInfo3);
            //    }
            //    var por4 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //    if (por4 != null)
            //    {
            //        rdb.ProfessionalTechnicalInfos.Remove(por4);
            //        WorkHistory.ProfessionalTechnicalInfo4.StartTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo4.EndTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo4.ProTecID = sys[6].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo4.ProTecNameID = skill[3].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo4.ProTecLevelID = sys[7].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo4.UserID = id;
            //        WorkHistory.ProfessionalTechnicalInfo4.Flag = 4;
            //        rdb.ProfessionalTechnicalInfos.Add(WorkHistory.ProfessionalTechnicalInfo4);
            //    }
            //    var por5 = rdb.ProfessionalTechnicalInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //    if (por5 != null)
            //    {
            //        rdb.ProfessionalTechnicalInfos.Remove(por5);
            //        WorkHistory.ProfessionalTechnicalInfo5.StartTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo5.EndTime = DateTime.Now;
            //        WorkHistory.ProfessionalTechnicalInfo5.ProTecID = sys[8].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo5.ProTecNameID = skill[4].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo5.ProTecLevelID = sys[9].ToString();
            //        WorkHistory.ProfessionalTechnicalInfo5.UserID = id;
            //        WorkHistory.ProfessionalTechnicalInfo5.Flag = 5;
            //        rdb.ProfessionalTechnicalInfos.Add(WorkHistory.ProfessionalTechnicalInfo5);
            //    }
            //    var skl1 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //    if (skl1 != null)
            //    {
            //        rdb.SkillLevelIdentificationInfos.Remove(skl1);
            //        WorkHistory.SkillLevelIdentificationInfo1.StartTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo1.EndTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo1.SkillTypeID = title[0].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo1.SKillLevelID = sys[10].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo1.UserID = id;
            //        WorkHistory.SkillLevelIdentificationInfo1.Flag = 1;
            //        rdb.SkillLevelIdentificationInfos.Add(WorkHistory.SkillLevelIdentificationInfo1);
            //    }
            //    var skl2 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //    if (skl2 != null)
            //    {
            //        rdb.SkillLevelIdentificationInfos.Remove(skl2);
            //        WorkHistory.SkillLevelIdentificationInfo2.StartTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo2.EndTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo2.SkillTypeID = title[1].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo2.SKillLevelID = sys[11].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo2.UserID = id;
            //        WorkHistory.SkillLevelIdentificationInfo2.Flag = 2;
            //        rdb.SkillLevelIdentificationInfos.Add(WorkHistory.SkillLevelIdentificationInfo2);
            //    }
            //    var skl3 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //    if (skl3 != null)
            //    {
            //        rdb.SkillLevelIdentificationInfos.Remove(skl3);
            //        WorkHistory.SkillLevelIdentificationInfo3.StartTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo3.EndTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo3.SkillTypeID = title[2].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo3.SKillLevelID = sys[12].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo3.UserID = id;
            //        WorkHistory.SkillLevelIdentificationInfo3.Flag = 3;
            //        rdb.SkillLevelIdentificationInfos.Add(WorkHistory.SkillLevelIdentificationInfo3);
            //    }
            //    var skl4 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //    if (skl4 != null)
            //    {
            //        rdb.SkillLevelIdentificationInfos.Remove(skl4);
            //        WorkHistory.SkillLevelIdentificationInfo4.StartTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo4.EndTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo4.SkillTypeID = title[3].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo4.SKillLevelID = sys[13].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo4.UserID = id;
            //        WorkHistory.SkillLevelIdentificationInfo4.Flag = 4;
            //        rdb.SkillLevelIdentificationInfos.Add(WorkHistory.SkillLevelIdentificationInfo4);
            //    }
            //    var skl5 = rdb.SkillLevelIdentificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //    if (skl5 != null)
            //    {
            //        rdb.SkillLevelIdentificationInfos.Remove(skl5);
            //        WorkHistory.SkillLevelIdentificationInfo5.StartTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo5.EndTime = DateTime.Now;
            //        WorkHistory.SkillLevelIdentificationInfo5.SkillTypeID = title[4].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo5.SKillLevelID = sys[14].ToString();
            //        WorkHistory.SkillLevelIdentificationInfo5.UserID = id;
            //        WorkHistory.SkillLevelIdentificationInfo5.Flag = 5;
            //        rdb.SkillLevelIdentificationInfos.Add(WorkHistory.SkillLevelIdentificationInfo5);
            //    }
            //    var occ1 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //    if (occ1 != null)
            //    {
            //        rdb.OccupationalQualificationInfos.Remove(occ1);
            //        WorkHistory.OccupationalQualificationInfo1.StartTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo1.EndTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo1.OccQuaID = sys[15].ToString();
            //        WorkHistory.OccupationalQualificationInfo1.OccQuaLevelID = sys[16].ToString();
            //        WorkHistory.OccupationalQualificationInfo1.UserID = id;
            //        WorkHistory.OccupationalQualificationInfo1.Flag = 1;
            //        rdb.OccupationalQualificationInfos.Add(WorkHistory.OccupationalQualificationInfo1);
            //    }
            //    var occ2 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //    if (occ2 != null)
            //    {
            //        rdb.OccupationalQualificationInfos.Remove(occ2);
            //        WorkHistory.OccupationalQualificationInfo2.StartTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo2.EndTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo2.OccQuaID = sys[17].ToString();
            //        WorkHistory.OccupationalQualificationInfo2.OccQuaLevelID = sys[18].ToString();
            //        WorkHistory.OccupationalQualificationInfo2.UserID = id;
            //        WorkHistory.OccupationalQualificationInfo2.Flag = 2;
            //        rdb.OccupationalQualificationInfos.Add(WorkHistory.OccupationalQualificationInfo2);
            //    }
            //    var occ3 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //    if (occ3 != null)
            //    {
            //        rdb.OccupationalQualificationInfos.Remove(occ3);
            //        WorkHistory.OccupationalQualificationInfo3.StartTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo3.EndTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo3.OccQuaID = sys[19].ToString();
            //        WorkHistory.OccupationalQualificationInfo3.OccQuaLevelID = sys[20].ToString();
            //        WorkHistory.OccupationalQualificationInfo3.UserID = id;
            //        WorkHistory.OccupationalQualificationInfo3.Flag = 3;
            //        rdb.OccupationalQualificationInfos.Add(WorkHistory.OccupationalQualificationInfo3);
            //    }
            //    var occ4 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //    if (occ4 != null)
            //    {
            //        rdb.OccupationalQualificationInfos.Remove(occ4);
            //        WorkHistory.OccupationalQualificationInfo4.StartTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo4.EndTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo4.OccQuaID = sys[21].ToString();
            //        WorkHistory.OccupationalQualificationInfo4.OccQuaLevelID = sys[22].ToString();
            //        WorkHistory.OccupationalQualificationInfo4.UserID = id;
            //        WorkHistory.OccupationalQualificationInfo4.Flag = 4;
            //        rdb.OccupationalQualificationInfos.Add(WorkHistory.OccupationalQualificationInfo4);
            //    }
            //    var occ5 = rdb.OccupationalQualificationInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //    if (occ5 != null)
            //    {
            //        rdb.OccupationalQualificationInfos.Remove(occ5);
            //        WorkHistory.OccupationalQualificationInfo5.StartTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo5.EndTime = DateTime.Now;
            //        WorkHistory.OccupationalQualificationInfo5.OccQuaID = sys[23].ToString();
            //        WorkHistory.OccupationalQualificationInfo5.OccQuaLevelID = sys[24].ToString();
            //        WorkHistory.OccupationalQualificationInfo5.UserID = id;
            //        WorkHistory.OccupationalQualificationInfo5.Flag = 5;
            //        rdb.OccupationalQualificationInfos.Add(WorkHistory.OccupationalQualificationInfo5);
            //    }
            //    var other1 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 1);
            //    if (other1 != null)
            //    {
            //        rdb.OtherEligibilityInfos.Remove(other1);
            //        WorkHistory.OtherEligibilityInfo1.StartTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo1.EndTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo1.OtherID = sys[25].ToString();
            //        WorkHistory.OtherEligibilityInfo1.UserID = id;
            //        WorkHistory.OtherEligibilityInfo1.Flag = 1;
            //        rdb.OtherEligibilityInfos.Add(WorkHistory.OtherEligibilityInfo1);
            //    }
            //    var other2 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 2);
            //    if (other2 != null)
            //    {
            //        rdb.OtherEligibilityInfos.Remove(other2);
            //        WorkHistory.OtherEligibilityInfo2.StartTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo2.EndTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo2.OtherID = sys[26].ToString();
            //        WorkHistory.OtherEligibilityInfo2.UserID = id;
            //        WorkHistory.OtherEligibilityInfo2.Flag = 2;
            //        rdb.OtherEligibilityInfos.Add(WorkHistory.OtherEligibilityInfo2);
            //    }
            //    var other3 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 3);
            //    if (other3 != null)
            //    {
            //        rdb.OtherEligibilityInfos.Remove(other3);
            //        WorkHistory.OtherEligibilityInfo3.StartTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo3.EndTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo3.OtherID = sys[27].ToString();
            //        WorkHistory.OtherEligibilityInfo3.UserID = id;
            //        WorkHistory.OtherEligibilityInfo3.Flag = 3;
            //        rdb.OtherEligibilityInfos.Add(WorkHistory.OtherEligibilityInfo3);
            //    }
            //    var other4 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 4);
            //    if (other4 != null)
            //    {
            //        rdb.OtherEligibilityInfos.Remove(other4);
            //        WorkHistory.OtherEligibilityInfo4.StartTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo4.EndTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo4.OtherID = sys[28].ToString();
            //        WorkHistory.OtherEligibilityInfo4.UserID = id;
            //        WorkHistory.OtherEligibilityInfo4.Flag = 4;
            //        rdb.OtherEligibilityInfos.Add(WorkHistory.OtherEligibilityInfo4);
            //    }
            //    var other5 = rdb.OtherEligibilityInfos.SingleOrDefault(a => a.UserID == id && a.Flag == 5);
            //    if (other5 != null)
            //    {
            //        rdb.OtherEligibilityInfos.Remove(other5);
            //        WorkHistory.OtherEligibilityInfo5.StartTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo5.EndTime = DateTime.Now;
            //        WorkHistory.OtherEligibilityInfo5.OtherID = sys[29].ToString();
            //        WorkHistory.OtherEligibilityInfo5.UserID = id;
            //        WorkHistory.OtherEligibilityInfo5.Flag = 5;
            //        rdb.OtherEligibilityInfos.Add(WorkHistory.OtherEligibilityInfo5);
            //    }
            //    var usInfo = rdb.UserInfos.Find(id);
            //    if (usInfo != null)
            //    {
            //        usInfo.Training = WorkHistory.UserInfo.Training;
            //        usInfo.Performance = WorkHistory.UserInfo.Performance;
            //        TryUpdateModel(usInfo);
            //    }
            //    rdb.SaveChanges();
            //    return RedirectToAction("Details", "WorkListInfo", new
            //    {
            //        id = id
            //    });
            //    //return RedirectToAction("Edit");

            //}
            //catch 
            //{
            //    return RedirectToAction("Index");
            //}
            return RedirectToAction("Index");
        }

        //
        // GET: /WorkHistory/Delete/5

        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /WorkHistory/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, WorkHistoryViewModels WorkHistory)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
